<?php $this->_extends('_layouts/main_layout'); ?>
<?php $this->_block('title'); ?>
	Add Email Offer
<?php $this->_endblock(); ?>

<?php $this->_block('contents'); ?>

<div id="content" class="box">
	<h1>Email Offers</h1>
		<?php if (isset($infos)) 
				{
					foreach ($infos as $info)
					{
		?>
				<p class="msg info"><?php echo $info;?></p>
		<?php		}
				}
		?>
		<fieldset>
			<legend>Banner Add Offer</legend>
		<?php if (isset($errors)) 
				{
					foreach ($errors as $error)
					{
		?>
				<p class="msg error"><?php echo $error;?></p>
		<?php		}
				}
		?>
			<form method="post" action="<?php echo url('bannermanager/addoffer');?>">
				<dl>
					<dt>Banner</dt>
					<dd>
						<select name="banner">
							<option value="left_banner">Left Banner</option>
							<option value="right_banner">Right Banner</option>
						</select>
					</dd>
				</dl>
				<dl>
					<dt>Site</dt>
					<dd>
						<?php
							 echo Util::buildDropDownList(
							 	array('id'=>'site', 'name'=>'site_id'),
							 	$sites,
							 	isset($site_id) ? $site_id: false,
							 	array('k'=>'', 'l'=>'--All--')
							 );
						?>
					</dd>
				</dl>
				<dl>
					<dt><label>Offer Name:</label></dt>
					<dd>
						<input type="text" name="offer_name" width="100%" class="txt_link" id="offer_name" value="<?php echo isset($offer_name) ? $offer_name : ''; ?>" />
					</dd>
				</dl>
				<dl>
					<dt><label>Partner Name:</label></dt>
					<dd>
						<select name="partner_name">
							<option value="PeanutLabs" <?php echo (isset($partner_name) && $partner_name == 'PeanutLabs') ? 'selected=selected' : '';?>>Peanut Labs</option>
							<option value="SuperRewards" <?php echo (isset($partner_name) && $partner_name == 'SuperRewards') ? 'selected=selected' : '';?>>Super Rewards</option>
							<option value="RadiumOne" <?php echo (isset($partner_name) && $partner_name == 'RadiumOne') ? 'selected=selected' : '';?>>Radium One</option>
							<option value="SponsorPay" <?php echo (isset($partner_name) && $partner_name == 'SponsorPay') ? 'selected=selected' : '';?>>SponsorPay</option>
							<option value="NoneOfAbove" <?php echo (isset($partner_name) && $partner_name == 'NoneOfAbove') ? 'selected=selected' : '';?>>None Of Above</option>
						</select>
					</dd>
				</dl>
				<dl>
					<dt><label>Picture URL:</label></dt>
					<dd><input type="text" name="picture_url" width="100%" value="<?php echo isset($picture_url) ? $picture_url : ''; ?>" class="txt_link" /></dd>
				</dl>
				<dl>
					<dt><label>Link URL:</label></dt>
					<dd>
						<input type="text" name="link_url" width="100%" value="<?php echo isset($link_url) ? $link_url : ''; ?>"  class="txt_link"/>
					</dd>
					<dd>
						<label style="color:#F00;">Paramaters: publisherId=?, oid=?, endUserId( = INSERT_END_USER_ID as a placeholder), email( = INSERT_END_USER_EMAIL as a placeholder)</label>
					</dd>
				</dl>
				<dl>
					<dt><label>Start Date</label></dt>
					<dd>
						<input type="text" name="start_date" class="myDatePickerClass" readonly="readonly" />
					</dd>
				</dl>
				<dl>
					<dt><label>End Date</label></dt>
					<dd>
						<input type="text" name="end_date" class="myDatePickerClass" readonly="readonly" />
						<script type="text/javascript">
	                       	$(".myDatePickerClass").datepicker({
	                           	dateFormat:'yy-mm-dd',
	                           	changeYear: true,
	                           	changeMonth: true,
	                        	showMonthAfterYear: true,
	                    	}).val('<?php echo isset($tosent_date)? $tosent_date : date('Y-m-d'); ?>');
	                	</script>
					</dd>
				</dl>
				<dl id="set_partial">
					<dt>
						<label for="is_partial">Is Partial</label>
						<input type="checkbox" name="is_partial" id="is_partial" value="1" />
						<script>
							$('[name="partner_name"]').change(function(){
								if($(this).val() != 'RadiumOne'){
									$('#set_partial').hide();
									$('#is_partial').removeAttr('checked');
								}else{
									$('#set_partial').show();
								}
							});
							$('[name="partner_name"]').change();
						</script>
					</dt>
				</dl>
				<input type="submit" value="Add Banner Offer" /> 
			</form>
		</fieldset>
		
</div>
<?php $this->_endblock(); ?>